-- the debug mode
if is_mode("debug") then
    
    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")

    add_cxflags("-MTd")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- enable fastest optimization
    set_optimize("fastest")

    -- strip all symbols
    set_strip("all")

    add_cxflags("-MT")
end

-- define target
target("server")

    -- set kind
    set_kind("binary")

    add_includedirs("libevent-2.0.22/inc")
    add_linkdirs("libevent-2.0.22/lib/x86")

    add_links("libevent_core", "libevent_extras", "libevent")
    add_links("ws2_32", "wsock32")

    -- add files
    add_files("src/server/main.cpp")

    add_defines("WIN32")
target_end()

-- define target
target("client")

    -- set kind
    set_kind("binary")

    add_includedirs("libevent-2.0.22/inc")
    add_linkdirs("libevent-2.0.22/lib/x86")

    add_links("libevent_core", "libevent_extras", "libevent")
    add_links("ws2_32", "wsock32")

    -- add files
    add_files("src/client/main.cpp")

    add_defines("WIN32")

    add_cxflags("-EHsc")
target_end()

-- define target
target("multi-server")

    -- set kind
    set_kind("binary")

    add_includedirs("libevent-2.0.22/inc")
    add_linkdirs("libevent-2.0.22/lib/x86")

    add_links("libevent_core", "libevent_extras", "libevent")
    add_links("ws2_32", "wsock32")

    -- add files
    add_files("src/server/multi-server/**.cc")

    add_defines("WIN32")
target_end()

-- define target
target("multi-client")

    -- set kind
    set_kind("binary")

    add_includedirs("libevent-2.0.22/inc")
    add_linkdirs("libevent-2.0.22/lib/x86")

    add_links("libevent_core", "libevent_extras", "libevent")
    add_links("ws2_32", "wsock32")

    -- add files
    add_files("src/client/multi-client/**.cc")

    add_defines("WIN32")

    add_cxflags("-EHsc")
target_end()

target("test")
    set_kind("binary")

    add_includedirs("libevent-2.0.22/inc")
    add_linkdirs("libevent-2.0.22/lib/x86")

    add_links("libevent_core", "libevent_extras")

    if is_os("windows") then
        add_defines("WIN32")
        add_links("ws2_32", "wsock32")
    end

    add_files("src/server/test/main.cc")

    add_cxflags("-EHsc")
target_end()
